package com.chiry.test.proxy.reflect;

import java.lang.reflect.Field;

public class ClazzAccessMethod {
    private final String properties = "chiry";
    public static void main(String[] args) throws NoSuchFieldException, ClassNotFoundException {
        //method 1
        ClazzAccessMethod clazzAccessMethod = new ClazzAccessMethod();
        Class<? extends ClazzAccessMethod> aClass = clazzAccessMethod.getClass();

        Field properties = aClass.getDeclaredField("properties");
        properties.setAccessible(true);
        String name = properties.getName();
        System.out.println("method 1"+name);
        //method

        Class<ClazzAccessMethod> clazzAccessMethodClass = ClazzAccessMethod.class;
        String name2 = clazzAccessMethodClass.getName();
        System.out.println("method 2"+name2);
        //method 3

        Class<?> aClass1 = Class.forName("com.chiry.test.proxy.reflect.ClazzAccessMethod");
        String name1 = aClass1.getName();
        System.out.println("method 3"+name1);

        //method 4
        Class<?> aClass2 = ClassLoader.getSystemClassLoader().loadClass("com.chiry.test.proxy.reflect.ClazzAccessMethod");
        String name3 = aClass2.getName();
        System.out.println("method 4"+name3);


    }
}
